#include "RenderObject.h"

namespace Nezha
{

	RenderObject::RenderObject()
		:mRenderLayer(RL_DEFAULT)
		,mBatchType(ROB_NONE)
		,mNumMatLayers(0)
		,mCastShadow(false)
		,mReceiveShadow(false)
	{

	}

	MaterialPtr RenderObject::getMaterial(u32 i)
	{
		NZ_ASSERT(i < MAX_NUM_MATERIAL_LAYERS);

		return mMatLayers[i];
	}

	void RenderObject::setMaterial(u32 i, const MaterialPtr& mat)
	{
		NZ_ASSERT(i < MAX_NUM_MATERIAL_LAYERS);

		mMatLayers[i] = mat;

		// recau numLayers
		mNumMatLayers = 0;
		for(int i = 0; i < MAX_NUM_MATERIAL_LAYERS; i++)
		{
			if(mMatLayers[i].notNull())
				++mNumMatLayers;
		}
	}

	void RenderObject::setCastShadow(bool b)
	{
		mCastShadow = b;
	}

	void RenderObject::setReceiveShadow(bool b)
	{
		mReceiveShadow = b;
	}

}//end namespace Nezha